<?php
class AboutController extends Controller
{
	/**
   * @return array action filters
   */
  public function filters()
  {
    return array(
	  'accessControl', // perform access control for CRUD operations
    );
  }
  /**
  * Specifies the access control rules.
  * This method is used by the 'accessControl' filter.
  * @return array access control rules
  */
  public function accessRules()
  {
    return array(
      array('allow', // allow authenticated user to perform 'create' and 'update' actions
        'actions' => array('index'),
        'users'   => array('@'),
      ),
      array('deny',  // deny all users
        'users' => array('*'),
      ),
    );
  }
	public function actionIndex()
	{
	  $model = About::model()->findByPk(1);
	  if (empty($model)) {
	    $model = new About();
	  }
	  
	  if (Yii::app()->request->isPostRequest) {
	    $model->about_en = $_POST['About']['about_en'];
	    $model->about_vi = $_POST['About']['about_vi'];
	    $model->modifieddate = time();
	    
	    $model->save();
	    Yii::app()->user->setFlash('success', Yii::t('default', 'Save successfully.'));
	    $this->refresh();
	  } 
		$this->render('index', array(
		  'model' => $model
		));
	}

}